﻿using System;
using System.Collections.Generic;

namespace Blader.UI
{
    public class MenuItemCollection
    {
        private static List<MenuItem> menuItems = new List<MenuItem>();

        public static List<MenuItem> MenuItems
        {
            get { return menuItems; }
            set { menuItems = value; }
        }

        static MenuItemCollection()
        {
            menuItems.Add(new MenuItem("OpenSql", "Open Sql(&Q)", "Open Selected Sql Files"));
        }

        public static MenuItem FindByName(string name)
        {
            string commandName = name.Substring(name.LastIndexOf('.') + 1);

            return menuItems.Find(delegate(MenuItem menuItem)
                                 {
                                     return commandName.Equals(menuItem.Name, StringComparison.CurrentCultureIgnoreCase);
                                 }
                  );
        }
    }
}
